package com.itheima.controller;

import com.itheima.dao.UserMapper3;
import com.itheima.domain.User3;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author robin
 * @version 1.0
 */
@RestController
@RequestMapping("/users")
public class UserController {
    @Autowired
    UserMapper3 userMapper3;

    @GetMapping
    public List<User3> queryAll() {
        return userMapper3.selectList(null);
    }

    @PostMapping
    public int saveUser(@RequestBody User3 user) {
        return userMapper3.insert(user);
    }
}
